package productos.dao;

import java.sql.*;

public class Aplicacion1 {

    public static void main(String[] args) {
        try {
            Class.forName("com.mysql.jdbc.Driver");
            Connection con =
                    DriverManager.getConnection("jdbc:mysql://127.0.0.1/masters3", "root", "");
            Statement stmt = con.createStatement();
            String idProducto = "1";
            ResultSet rs = stmt.executeQuery("select idProductos,stock,modelo,tipo_tela,talla,color,costo from productos where idProductos=' " + idProducto + " ' ");
            if (rs.next()) {
                System.out.println("Stock: " + rs.getString("stock"));
                System.out.println("Modelo: " + rs.getString("modelo"));
                System.out.println("Precio: " + rs.getString("precio"));
                System.out.println("Tipo_tela: " + rs.getString("tipo_tela"));
                System.out.println("Talla: " + rs.getString("talla"));
                System.out.println("Color: " + rs.getString("color"));
                System.out.println("Costo: " + rs.getString("costo"));
            }
            rs.close();
            stmt.close();
            con.close();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
